package com.sq.partner.manager.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.sq.partner.manager.common.Result;
import com.sq.partner.manager.mybatis.model.GatewayAgency;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.mybatis.model.TradAgentInfo;
import com.sq.partner.manager.mybatis.model.TradAgentInfoRela;
import com.sq.partner.manager.mybatis.model.TradInsuPlan;
import com.sq.partner.manager.util.Page;


/**
 * 
 * @author zzguo
 *
 */
public interface IGatewayAgentInfoRelaDao extends BaseDao{
	
	public Page<GatewayAgency> queryInfoByCriteria(Page<GatewayAgency> page,GatewayUser user) throws Exception;
	
	public Page<Map<String,Object>> queryAgentInfoRelaWithUserPageByCriteria(Page<Map<String,Object>> page) throws Exception;
	
	public Page<Map<String,Object>> queryAgentInfoRelaWithChannelPageByCriteria(Page<Map<String,Object>> page) throws Exception;

	public Page<Map<String,Object>> queryAgentInfoRelaWithCombinedPageByCriteria(Page<Map<String,Object>> page) throws Exception;
	
	public boolean addAgencyInfo(GatewayAgency agency) throws Exception;

	public boolean updateAgencyInfo(GatewayAgency agency) throws Exception;

	public boolean deleteAgencyInfo(GatewayAgency agency) throws Exception;

	public GatewayAgency queryAgencyInfoByCode(GatewayAgency agency) throws Exception;
	
	public int checkIsExistFacadeUser(String agencyCode) throws Exception;
	
	
	public boolean addAgentInfoRela(TradAgentInfoRela  tradAgentInfoRela) throws Exception;
	
	public boolean upadteAgentInfoRela(TradAgentInfoRela  tradAgentInfoRela) throws Exception;
	
	public boolean deleteAgentInfoRela(TradAgentInfoRela  tradAgentInfoRela) throws Exception;
	
	public List<Map> queryAgentInfoByInsuPlanNo(String insuPlanNo)throws Exception;
	
	/**
	 * 根据方案号与agentInfoIds删除TradAgentInfoRela
	 * @param insuPlanNo
	 * @param agentInfoIds
	 * @return
	 * @throws Exception
	 */
	public boolean delTradAgentInfoRelaByInsuplannoAndAgentIds(String insuPlanNo ,String  agentInfoIds) throws Exception;
	
	/**
	 * 根据方案号与agentInfoId添加或更新TradAgentInfoRela
	 * @param tradAgentInfoRela
	 * @return
	 * @throws Exception
	 */
	public boolean addOrUpdateTradAgentInfoRela(TradAgentInfoRela  tradAgentInfoRela) throws Exception;

	/**批量新增代理信息**/
	public boolean addTradAgentInfoRelaBach(List<TradAgentInfoRela>  tradAgentInfoRelas) throws Exception;
	
	/**
	 * 根据方案号删除该方案下关联的代理信息
	 * @param insuPlanNo
	 * @return
	 * @throws Exception
	 */
	public boolean delTradAgentInfoRelaByPlanNo(String planNo) throws Exception;
	
	/**
	 * 复制新增代理信息
	 * @param insuplan
	 * @param oldPlanNo
	 * @return
	 * @throws Exception
	 */
	public boolean copyTradAgentInfoRela(String newPlanNo,String oldPlanNo) throws Exception;
	
	/**
	 * 查询代理信息关系表
	 * @param insuplan
	 * @throws Exception
	 */
	public List<TradAgentInfoRela> queryTradAgentInfoRelaByMap(TradAgentInfoRela tradAgentInfoRela) throws Exception;
	
	/**导出方案代理关联查询*/
	public  List<Map<String, Object>> impNlifeRela(Map<String, Object>map) throws Exception;
	
	/**总对总区域*/
	public Page<Map<String,Object>> queryZonAgentInfoRelaWithPageByCriteria(Page<Map<String,Object>> page) throws Exception;

	/**联合出单区域*/
	public Page<Map<String,Object>> queryZonAgentInfoRelaWithPageByParam(Page<Map<String,Object>> page) throws Exception;
	/**
	 * 删除区域总对总信息
	 * @param nlifePlan
	 * @return
	 * @throws Exception
	 */
	public boolean delZonTradInfo(Map<String, Object> map) throws Exception;
	/**
	 * 删除区域联合出单信息
	 * @param nlifePlan
	 * @return
	 * @throws Exception
	 */
	public boolean delZonTradInfo5(Map<String, Object> map) throws Exception;
	/***
	 * 添加区域总对总信息
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public void addZonTradInfo(List<TradAgentInfoRela> list) throws Exception;

	/***
	 * 添加区域联合出单信息
	 * @param list
	 * @return
	 * @throws Exception
	 */
	public void addZonTradInfo5(List<TradAgentInfoRela> list) throws Exception;

	
    public List<Map<String,Object>> queryAgentInfoList(String deptNo,String planNo,String partnerNo) throws Exception;
      /**
     * 查询车险方案信息
     * @param 
     * @return
     * @throws Exception
     */
    public List<TradAgentInfoRela> selectCarPlanCodeInfoList (String partnerCode,String subChannelCode) throws Exception;
    /**
     * 导入时查询已经存在的车险信息
     * @param map
     * @return
     * @throws Exception
     */
    public List<TradAgentInfoRela> selectAlreadyExistsCarInfoList (String partnerCode,String subChannelCode) throws Exception;
    /**
     * 更新已有的车险信息
     * @param list
     * @return
     */
    public void updateAlreadyExistsCarInfo(List<TradAgentInfoRela> list) throws Exception;
    /**
     * 车险新增手续费信息
     * @param list
     * @return
     * @throws Exception
     */
    public void insertIntoAgentRealForCar (List<TradAgentInfoRela> list)throws Exception;
    /**
     * 根据代理ID删除车险费用信息
     * @param id
     */
    public void deleteAgentInfoRela(String id) throws Exception;
    
    public  List<Map<String, Object>> impNocarRela(Map<String, Object> map)throws Exception;
    
    public List<TradAgentInfoRela> selectAgentRela (String id) throws Exception;
}
